fix: skip FreshLine by semantic integration in ble.sh #5072
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A problem was originally reported in akinomyoga/ble.sh#413.
ble.sh
(a line editor for Bash) keeps track of the cursor position in the terminal display (including the horizontal position relative to the bottom of the terminal) based on the terminal control sequences that it sends.However, with WezTerm's semantic integration, WezTerm may insert a newline in
precmd
(FreshLine), which breaks the cursor position tracking ofble.sh
. The needed cursor position adjustment at the end of the command execution is already performed byble.sh
, so WezTerm does not need to adjust it. In this patch, we skip the request for FreshLine inble.sh
.But I'm not sure if this is the correct fix. The original sequence OSC A seems to perform FreshLine and StartPrompt. To only perform StartPrompt, one seems to be able to use the sequence OSC P ... BEL. Although OSC P seems to receive a parameter
k=?
, it doesn't seem to be used in the codebase, so I just omitted the parameterk
. Could you take a look at this?Note: As an alternative option, we can specify the ble.sh option
bleopt prompt_command_changes_layout=1
to notify thatprecmd
/PROMPT_COMMAND
can change the cursor position (in particular horizontal position), but this adds unneeded flickering of the rendered contents. Because we can just suppress FreshLine this time, I didn't use this approach.